<?php
session_start();
require_once("lib/util.php");
require_once("lib/db.php");
require_once("lib/user.php");
require_once("lib/incident.php");
$user_id = $_SESSION["logged_in_user"];
connect();
$user_incidents = query_user_incidents($user_id);
$user_name = query_name($user_id);
$user_incidents = set_total_rating ($user_incidents);

close();
render("user_nits", array("user_incidents" => $user_incidents, "user_name" => $user_name));
function query_user_incidents($user_id){
	$query = "SELECT * FROM incidents WHERE creator_user_id = ?";
	$incidents = query($query, array($user_id));
	return $incidents;
}

